<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <home></home>
  </div>
  <script src="./vue.js"></script>
  <script>
    const Child = {
      template:`
        <div>
          <header>
            子组件头部
          </header>  
          <slot :data="arr" :a="10"></slot>
          <footer>
            子组件底部
            </footer>
        </div>
      `,
      data(){
        return {
          arr: [1,2,3,4],
          a:10
        }
      }
    }
    const Home = {
      template:`
        <div>
          <h2>home页</h2>  
          <child>
            <div slot-scope="scope">
              {{ scope.data }}
              <ul>
                <li v-for="item in scope.data" :key="item">
                  {{ item }}  
                </li>  
              </ul>
              <button>子组件插槽传入内容</button>  
            </div>
          </child>
        </div>
      `,
      components:{
        Child
      }
    }


    Vue.component('Home',Home)
    const vm = new Vue({
      el:'#app'
    })
  </script>
</body>
</html>